home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-13 | 3.2 KB | 89 lines | [TEXT/EMAC] |
- ;;;
- ;;; Apple event support for Think C
- ;;;
-
- (require 'mac-runtime "mac/runtime")
-
- (defvar tc:debug-trace nil)
- (defvar tc:debug-failures nil)
-
- (defun declare-TPM-buffer-variable (name default-value)
- (make-variable-buffer-local name)
- (set-default name default-value))
-
- (declare-TPM-buffer-variable 'tc:have-TPM-data nil)
- (declare-TPM-buffer-variable 'tc:addressables nil)
- (declare-TPM-buffer-variable 'tc:oldSelStart 0)
- (declare-TPM-buffer-variable 'tc:oldSelEnd 0)
- (declare-TPM-buffer-variable 'tc:oldTextLen 0)
- (declare-TPM-buffer-variable 'tc:oldNumLines 0)
- (declare-TPM-buffer-variable 'tc:oldLineStart 0)
- (declare-TPM-buffer-variable 'tc:oldLineEnd 0)
-
- (defconst tc:markers-offset 0)
- (defconst tc:breakpoints-offset 4)
- (defconst tc:dataviews-offset 8)
- (defconst tc:lineOffsets-offset 12)
- (defconst tc:bkptIDs-offset 16)
- (defconst tc:dtvuIDs-offset 20)
- (defconst tc:bkptSizes-offset 24)
- (defconst tc:dtvuSizes-offset 28)
-
- (defconst tc:sizeof-addressables 32)
-
- (defun tc:addressables-get (offset)
- (tc:create-addressables)
- (extract-internal tc:addressables offset 'unsigned-long))
-
- (defun tc:addressables-set (offset x)
- (tc:create-addressables)
- (encode-internal tc:addressables offset 'unsigned-long x))
-
- (defun tc:markers () (tc:addressables-get tc:markers-offset))
- (defun tc:breakpoints () (tc:addressables-get tc:breakpoints-offset))
- (defun tc:dataviews () (tc:addressables-get tc:dataviews-offset))
- (defun tc:lineOffsets () (tc:addressables-get tc:lineOffsets-offset))
- (defun tc:bkptIDs () (tc:addressables-get tc:bkptIDs-offset))
- (defun tc:dtvuIDs () (tc:addressables-get tc:dtvuIDs-offset))
- (defun tc:bkptSizes () (tc:addressables-get tc:bkptSizes-offset))
- (defun tc:dtvuSizes () (tc:addressables-get tc:dtvuSizes-offset))
-
- (defun setf-tc:markers (x) (tc:addressables-set tc:markers-offset x))
- (defun setf-tc:breakpoints (x) (tc:addressables-set tc:breakpoints-offset x))
- (defun setf-tc:dataviews (x) (tc:addressables-set tc:dataviews-offset x))
- (defun setf-tc:lineOffsets (x) (tc:addressables-set tc:lineOffsets-offset x))
- (defun setf-tc:bkptIDs (x) (tc:addressables-set tc:bkptIDs-offset x))
- (defun setf-tc:dtvuIDs (x) (tc:addressables-set tc:dtvuIDs-offset x))
- (defun setf-tc:bkptSizes (x) (tc:addressables-set tc:bkptSizes-offset x))
- (defun setf-tc:dtvuSizes (x) (tc:addressables-set tc:dtvuSizes-offset x))
-
- (defun tc:create-addressables ()
- (if (not tc:addressables)
- (setq tc:addressables (NewPtrClear tc:sizeof-addressables))))
-
- ;;; These functions operate on the current buffer.
- (defun tc:selStart () (1- (point)))
- (defun tc:selEnd () (1- (if (mark) (mark) (point))))
- (defun tc:numLines () (count-lines 1 (1+ (buffer-size))))
- (defun tc:lineStart () (tc:charPos-to-lineNum (point)))
- (defun tc:lineEnd () (tc:charPos-to-lineNum (if (mark) (mark) (point))))
- (defun tc:textLen () (buffer-size))
-
- ;;; This imitates a lookup in a TextEdit lineStarts array.
- (defun tc:charPos-to-lineNum (c)
- (save-excursion
- (goto-char c)
- (let ((i 0))
- (while (search-backward "\n" nil t)
- (setq i (1+ i)))
- i)))
-
- (load "think-c/tc-header")
- (load "think-c/tc-send")
- (load "think-c/tc-exist")
- (load "think-c/tc-edit-send")
- (load "think-c/tc-reply")
- (load "think-c/tc-receive")
- (load "think-c/tc-menu")
- (load "think-c/think-ref")
-